# -*- coding: UTF-8 -*-
"""
@File    ：7.元组.py
@Author  ：techPang
@Date    ：2025/1/22 15:51 
@Version ：1.0
不可修改
"""

# -------------------------------------------元组()------------------------------------------------------
"""
定义空元组
变量名 = ()
变量名 = tuple()

定义的元组中只有一个元素
变量名 = (元素1,)   需要在后面加一个 , 
"""

tuple1 = ("czt", "ljx", "tjy",)

# 根据元素值查找索引
tuple1.index("czt")

# 统计某个元素的个数
tuple1.count("czt")

# 统计元组中所有元素的个数
len(tuple1)


def tuple_for_func():
    """
    for循环遍历元组
    :return:
    """
    tuple_test = ("czt", "ljx", "tjy",)
    for i in tuple_test:
        print(i)


def tuple_while_func():
    """
    while循环遍历元组
    :return:
    """
    tuple_test = ("czt", "ljx", "tjy",)
    index = 0
    while index < len(tuple_test):
        element = tuple_test[index]
        print(element)
        index += 1

